package cn.rongdao.jrkabao.ui.information.adapter;


import cn.rongdao.jrkabao.R;
import cn.rongdao.jrkabao.bean.information.QuotaBean;
import cn.rongdao.jrkabao.ui.information.adapter.baseadapter.BaseRecycleAdapter;
import cn.rongdao.jrkabao.ui.information.adapter.baseadapter.BaseViewHolder;
import cn.rongdao.jrkabao.ui.information.listener.OnItemActionListener;
import cn.rongdao.jrkabao.ui.information.uicomponent.MyQuotaItemComponent;

/**
 * Created by Wang on 17/9/21.
 */

public class MyQuotaAdapter extends BaseRecycleAdapter<QuotaBean.ValidationBean> {
    private float itemHtight;
    private OnItemActionListener meOnClickListener;

    public MyQuotaAdapter(float screenHeight) {
        this.itemHtight = (float) (screenHeight * 0.66) / 3;
    }

    @Override
    public int getLayoutId(int viewType) {
        return R.layout.item_myquota;
    }

    @Override
    public void convert(BaseViewHolder holder, final QuotaBean.ValidationBean validationBean, int position) {
        MyQuotaItemComponent itemComponent = (MyQuotaItemComponent) holder.getView(R.id.item_myquota_component);
        if(itemComponent == null){
            return;
        }
        itemComponent.setItemHeight(itemHtight);
        itemComponent.setQuotaBeanValidationBean(validationBean,position);
        itemComponent.setOnItemActionListener(meOnClickListener);
    }
    public void setOnItemActionListener(OnItemActionListener onItemActionListener) {
        this.meOnClickListener = onItemActionListener;
    }
}
